const getLineChart = (data: any) => {
  const { legendData, seriesData, xAxisData, colorList } = data
  return {
    legend: {
      data: legendData,
    },
    grid: {
      left: 30,
      right: 20,
      top: 30, //拉伸距离顶部高度
      bottom: 0, //拉伸距离底部高度
      containLabel: true,
    },
    tooltip: {
      trigger: 'axis',
    },
    xAxis: {
      type: 'category',
      boundaryGap: true, // 数值居中还是居边
      data: xAxisData,
      axisTick: {
        // 刻度线
        show: false,
      },
      axisLine: {
        onZero: false, // 两边留白
      },
      // axisLabel: {
      //   interval: 0
      // },
      splitLine: {
        //分割线
        show: true,
      },
    },
    yAxis: {
      type: 'value',
      splitLine: {
        //分割线
        show: false,
      },
    },
    series: seriesData.map((v: any, i: number) => {
      return {
        name: legendData[i],
        data: v,
        symbol: 'circle', //拐点圆形
        symbolSize: 5, //拐点大小
        smooth: true, //变平滑
        lineStyle: {
          normal: {
            width: 6,
            color: colorList[i] || 'auto',
          },
        },
        itemStyle: {
          normal: {
            color: colorList[i] || 'auto', //拐点颜色
            borderColor: colorList[i] || 'auto', //拐点边框颜色
            borderWidth: 0,
          },
        },
        type: 'line',
      }
    }),
  }
}
export default getLineChart
